<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>消息管理</title>
    <meta name="decorator" content="default"/>
    <link href="${ctxStatic}/static_back/css/public.css" type="text/css" rel="stylesheet">
    <link href="${ctxStatic}/static_back/css/main.css" type="text/css" rel="stylesheet">
</head>

<body>
    <%--标题--%>
    <div class="top-section">
        <h2>发布通知</h2>
    </div>

    <div class="body-section white-body">
        <%--功能区--%>
        <form:form id="searchForm" modelAttribute="airSendMessage" action="${ctx}/air/airSendMessage/" method="post" >
            <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
            <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
            <div class="function-box">
                <div class="left-function">
                    <form:select path="type">
                        <form:option label="全部类型" value=""/>
                        <form:options items="${fns:getDictList('msg_type')}" itemLabel="label" itemValue="value"
                                      htmlEscape="false"/>
                    </form:select>
                    <form:select path="recevier">
                        <form:option label="所有接收方" value=""/>
                        <form:options items="${fns:getDictList('msg_receiver')}" itemLabel="label" itemValue="value"
                                      htmlEscape="false"/>
                    </form:select>
                    <form:select path="sender">
                        <form:option label="所有发布方" value=""/>
                        <form:options items="${fns:getDictList('msg_sender')}" itemLabel="label" itemValue="value"
                                      htmlEscape="false"/>
                    </form:select>
                    <input id="btnSubmit" class="btn btn-main" type="submit" value="查询"/>
                </div>
                <div class="right-function">
                    <shiro:hasPermission name="air:airSendMessage:edit">
                    <a href="${ctx}/air/airSendMessage/form" class="btn btn-blue">新增通知</a>
                    </shiro:hasPermission>
                </div>
            </div>
        </form:form>
        <sys:message content="${message}"/>

        <%--表格区--%>
        <div class="table-box">
            <table id="contentTable">
                <thead>
                <tr>
                    <th width="10%" style="text-align: left">消息类型</th>
                    <th width="10%" style="text-align: left">接收方</th>
                    <th style="text-align: left">消息内容</th>
                    <th width="12%" style="text-align: left">推送方式</th>
                    <th width="10%" style="text-align: left">发布方</th>
                    <th width="14%" style="text-align: left">发布时间</th>
                    <th width="8%">操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${page.list}" var="airSendMessage">
                    <tr>
                        <td>
                                ${fns:getDictList('msg_type').get(airSendMessage.type-1)}
                        </td>
                        <td>
                                ${fns:getDictList('msg_receiver').get(airSendMessage.recevier-1)}
                        </td>
                        <td>
                                ${airSendMessage.content}
                        </td>
                        <td>
                                ${fns:getDictList('send_type').get(0)}
                                <c:if test="${airSendMessage.sendType == 2}">
                                    、${fns:getDictList('send_type').get(airSendMessage.sendType-1)}
                                </c:if>
                        </td>
                        <td>
                                ${fns:getDictList('msg_sender').get(airSendMessage.sender-1)}
                        </td>
                        <td>
                                <fmt:formatDate value="${airSendMessage.sendDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
                        </td>
                        <td class="td-center">
                                <a href="${ctx}/air/airSendMessage/delete?id=${airSendMessage.id}"
                                   onclick="return confirmx('确认要删除该消息吗？', this.href)" class="font-link">删除</a>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
            <div class="pagination table-pagination">${page}</div>
        </div>
    </div>

    <script type="text/javascript">
        function page(n, s) {
            $("#pageNo").val(n);
            $("#pageSize").val(s);
            $("#searchForm").submit();
            return false;
        }
    </script>
</body>
</html>